<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台管理系统-治疗方法管理</title>

<link rel="stylesheet" type="text/css" href="resources/css/treatment_method.css">
<%@ include  file="../includes/icon.html" %>
</head>
<body>

   <div class="headbar">
        
   </div>
   <div class="linkbar">
    <div>
        <span style="display:inline-block;width:80%;float:left;color:white;line-height:40px;">
            <a class="linkbar_a" href="admin/searchHealthUser">数据手工录入</a> | <a class="linkbar_a" href="admin/queryAutoInput">数据自动录入</a> 
        </span>
        <span style="display:inline-block;width:20%;float:right;color:white;line-height:40px;">
            <a class="linkbar_a" href="doctor/diagnoseBrainTumour" style="float:right;padding-right:30px">在线诊断</a>
        </span>
       </div> 
   </div>
   <div class="body">
       
         <table class="body">
           <tr>
              <td class="nav_list"   valign="top">
                <div> 
                   <dl class="nav_list">
                      <dd class="no-selected" ><a href="admin/searchHealthUser">病人信息</a></dd>
                      <dd class="no-selected" ><a href="admin/queryMedicalCase">疾病实例</a></dd>
                      <dd class="selected" ><a href="admin/queryTreatmentMethod">治疗方法</a></dd>
                      <dd class="no-selected" ><a href="admin/queryDesease">疾病表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryFeature">特征表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryLabSheet">化验单定义</a></dd>
                      <dd class="no-selected" ><a href="admin/queryLabSheetResult">化验单结果</a></dd>
                      <dd class="no-selected" ><a href="admin/queryMedicine">药物表</a></dd>
                      <dd class="no-selected" ><a href="admin/querySystemUser">系统用户</a></dd>
                      <dd class="no-selected" ><a href="admin/queryTreatmentMethod">城市表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryOccupation">职业表</a></dd>
                      <dd class="no-selected" ><a href="admin/queryBodyPart">身体部位表</a></dd>
                   </dl>
                </div>
              </td>
              <td class="content" valign="top">
                  <div class="search_bar"> 
                    <sf:form action="admin/queryTreatmentMethod" method="POST" modelAttribute="condition"> 
                    <span class="search_condition">
                       <div style="width:100%;margin-left:30px;margin-top:30px;">
                       
                           <font>方法名： </font><sf:input path="method_name"  style="width:150px;" placeholder="请输入方法名" value ="${condition.method_name}" />
                          
                       </div>
                    </span>
                    <span class="search_button">
                         <input type="submit" class="search_button" value="查询">
                    </span>
                    </sf:form>
                  </div>
                  
                  
                  
                  <script language="javascript"> 
                    var isShown = false;
                    var needShown= ${isAddNewShow};
                    function clickAddDiv()
                    {
                    	if (isShown == false)
                    	{	
                    		showAddDiv();
                    		
                    	}
                    	else
                    	{
                    		hideAddDiv();
                    	}
                    }
					function showAddDiv() {

					  d=document.getElementById("add_new_treatment_method");
					  d.style.display="inline-block";
					  
					  isShown =true;
					}
					function hideAddDiv() {

						  d=document.getElementById("add_new_treatment_method");
						  d.style.display="none";
						  isShown = false;
				    }
					
				 </script> 
                  
                  
                  <div class="status_bar">
                     <div style="display:block;float:left">搜索结果：</div>   <div class="add_new_button" onClick="clickAddDiv()" >添加+</div>
                  </div>
                  
                  <div class="add_new_health_user" id="add_new_treatment_method">
                     <sf:form action="admin/addTreatmentMethod" method="POST" modelAttribute="new_treatment_method"> 
                    <span class="add_new_health_user">
                        <div style="width:100%;margin-left:30px;margin-top:17px;">
                            <font>方法名： </font><sf:input path="method_name"  style="width:120px;" placeholder="输入治疗方法名称"   />
                            <font>英文名： </font><sf:input path="method_english_name"  style="width:120px;" placeholder="输入治疗方法英文名称"   />
                            <font>价格(￥)： </font><sf:input path="price"  style="width:90px;" placeholder="输入治疗费用单价"   />
                            <font>推荐医院： </font><sf:input path="recommand_hospital"  style="width:150px;" placeholder="输入治疗推荐医院"   />
                        </div>
                        <div style="width:100%;margin-left:30px;margin-top:6px;margin-bottom:6px;">
                           <font>详情： </font><br>
                           <sf:input path="details"  style="width:600px;" placeholder="输入治疗方法详细"   />
                        </div>
                    </span>
                    <span class="add_button">
                          <input type="submit" class="add_button" value="添加" />
                          <div class="add_button">
                              <font style="color:blue;font-size:15px;" onclick="hideAddDiv()" >取消</font>
                          </div>
                    </span>
                    </sf:form>
                  </div>
                  
                  <div class="information" id="information">
                     ${information} 
                  </div>
                  
                  
                  <div class="user_list">
                     <div class="row"> 
                         <span style="width:80px">序号</span>
	                     <span style="width:120px">方法名称</span>
	                     <span style="width:120px">英文名称</span>
	                     <span style="width:90px">价格</span>
	                     <span style="width:150px">推荐医院</span>
	                     <span style="width:250px">操作</span>
                     </div>
                     
                      <script language="javascript">
			                    function clickEditDiv(id)
			                    {
			                    	if (document.getElementById("edit_treatment_method"+id).style.display=='none')
			                    	{	
			                    		showEditDiv(id);
			                    	}
			                    	else
			                    	{
			                    		hideEditDiv(id);
			                    	}
			                    }
								function showEditDiv(id) {
			
								  d=document.getElementById("edit_treatment_method"+id);
								  d.style.display="inline-block";
								  isShown =true;
								}
								function hideEditDiv(id) {
			
									  d=document.getElementById("edit_treatment_method"+id);
									  d.style.display="none";
									
									  isShown = false;
							    }
								
								function clickDetailDiv(id)
			                    {
			                    	if (document.getElementById("detail_treatment_method"+id).style.display=='none')
			                    	{	
			                    		showDetailDiv(id);
			                    	}
			                    	else
			                    	{
			                    		hideDetailDiv(id);
			                    	}
			                    }
								function showDetailDiv(id) {
			
								  d=document.getElementById("detail_treatment_method"+id);
								  d.style.display="inline-block";
								  isShown =true;
								}
								function hideDetailDiv(id) {
			
									  d=document.getElementById("detail_treatment_method"+id);
									  d.style.display="none";
									
									  isShown = false;
							    }
				           </script> 
                     
                     <c:forEach var = "treatment_method_item"   items= "${treatment_method_list}"  varStatus="xh">
                     
                         <div class="row">
							     <span style="width:80px">${xh.count}</span>
			                     <span style="width:120px">${treatment_method_item.method_name}</span>
			                     <span style="width:120px">${treatment_method_item.method_english_name}</span>
			                     <span style="width:90px">${treatment_method_item.price}</span>	
			                     <span style="width:150px">
			                         <c:if test="${treatment_method_item.recommand_hospital.length()>8}">
			                             <font>${treatment_method_item.recommand_hospital.substring(0,8)+'...'}</font>
			                         </c:if>
			                         <c:if test="${treatment_method_item.recommand_hospital.length()<=8}">
			                             <font>${treatment_method_item.recommand_hospital}</font>
			                         </c:if>
			                     </span>		                    
			                   
			                     <span style="width:250px">
			                        <a class="operation"  onClick="clickDetailDiv(${treatment_method_item.treatment_method_def_id})" >详情</a>
			                        <a class="operation"  onClick="clickEditDiv(${treatment_method_item.treatment_method_def_id})" >编辑</a>
			                     </span>  
                    	 </div>
                    	 
                    	 <div class="edit_health_user" id="edit_treatment_method${treatment_method_item.treatment_method_def_id}" style="display:${treatment_method_item.displayName}">
		                   <sf:form action="admin/editTreatmentMethod" method="POST" modelAttribute="edit_treatment_method"> 
		                    <span class="add_new_health_user">
		                       <sf:input path="treatment_method_def_id" type="hidden" value="${treatment_method_item.treatment_method_def_id}" />
		                       <div style="width:100%;margin-left:30px;margin-top:17px;">
		                            <font>方法名： </font><sf:input path="method_name"  style="width:120px;" value="${treatment_method_item.method_name}"   />
		                            <font>英文名： </font><sf:input path="method_english_name"  style="width:120px;" value="${treatment_method_item.method_english_name}"   />
		                            <font>价格(￥)： </font><sf:input path="price"  style="width:90px;" value="${treatment_method_item.price}"   />
		                            <font>推荐医院： </font><sf:input path="recommand_hospital"  style="width:150px;" value="${treatment_method_item.recommand_hospital}"   />
		                        </div>
		                        <div style="width:100%;margin-left:30px;margin-top:6px;margin-bottom:6px;">
		                           <font>详情： </font><br>
		                           <sf:input path="details"  style="width:600px;" value="${treatment_method_item.details}"    />
		                        </div>
		                    </span>
		                    <span class="add_button">
		                          <input type="submit" class="add_button" value="确认" />
		                          <div class="add_button">
		                              <font style="color:blue;font-size:15px;" onclick="hideEditDiv(${treatment_method_item.treatment_method_def_id})" >取消</font>
		                          </div>
		                    </span>
		                    </sf:form>
		                  </div>
		                  
		                  
		                  <div class="detail_health_user" id="detail_treatment_method${treatment_method_item.treatment_method_def_id}" style="display:none">
		
		                    <span class="add_new_health_user">
		                    
		                         <div style="width:100%;margin-left:30px;margin-top:17px;">
		                            <font>方法名： </font><span class="detail_text" path="method_name"  style="width:120px;"  >${treatment_method_item.method_name}</span>   
		                            <font>英文名： </font><span class="detail_text" path="method_english_name"  style="width:120px;"  >${treatment_method_item.method_english_name}</span>   
		                            <font>价格(￥)： </font><span class="detail_text" path="price"  style="width:90px;"  >${treatment_method_item.price}</span>   
		                            <font>推荐医院： </font><span class="detail_text" path="recommand_hospital"  style="width:150px;"  >${treatment_method_item.recommand_hospital}</span>   
		                        </div>
		                        <div style="width:100%;margin-left:30px;margin-top:6px;margin-bottom:6px;">
		                           <font>详情： </font><br>
		                           <span class="detail_text" path="details"  style="width:600px;" >${treatment_method_item.details}</span> 
		                        </div>
		                    </span>
		                    <span class="add_button">
		                          <input type="submit" class="add_button" onclick="hideDetailDiv(${treatment_method_item.treatment_method_def_id})" value="关闭" />
		                    </span>
		                    
		                  </div>
		                  
                     </c:forEach>
                     
                   
                    
                  </div>
              </td>
           </tr>
         </table>
       
   </div>
   <div class="bottom">
   
   </div>
   
   
</body>
</html>